package BehavioralMode.observer.WeChatOfficialAccount;

/**
 * 观察者模式 微信公众号推送消息实列
 */
public class Client {

    public static void main(String[] args) {
        ConcreteSubject concreteSubject = new ConcreteSubject();

        Observer observer1 = new ConcreteObserver("小红");
        Observer observer2 = new ConcreteObserver("小明");
        Observer observer3 = new ConcreteObserver("小蓝");

        // 订阅
        concreteSubject.addObserver(observer1);
        concreteSubject.addObserver(observer2);
        concreteSubject.addObserver(observer3);

        // 发布
        concreteSubject.notifyMsg("看春晚了");
    }
}
